package com.yanqu.road.entity.union.huaben;

import com.alibaba.fastjson.JSON;
import com.yanqu.road.entity.DataObject;
import com.yanqu.road.entity.FieldTypeAnnotation;
import com.yanqu.road.entity.player.UserBaseInfo;

import java.util.Objects;

@FieldTypeAnnotation(tableName = "t_c_hua_ben_member_week", desc = "商会话本-成员数据")
public class UnionHuaBenMemberWeekData extends DataObject {

    @FieldTypeAnnotation(select = true, desc = "玩家ID", update = true)
    private long userId;

    @FieldTypeAnnotation(desc = "周id", update = true)
    private int weekId;

    @FieldTypeAnnotation(desc = "玩家区服id")
    private long serverId;

    @FieldTypeAnnotation(desc = "参与的商会uid")
    private String unionUid;

    @FieldTypeAnnotation(desc = "可派遣次数")
    private int canSendTimes;

    @FieldTypeAnnotation(desc = "已派遣次数")
    private int sendTimes;

    @FieldTypeAnnotation(desc = "重置时间")
    private int resetTime;

    @FieldTypeAnnotation(desc = "积分")
    private int score;

    @FieldTypeAnnotation(desc = "话本结算-额外积分")
    private int settleScore;

    private UserBaseInfo userBaseInfo;

    @FieldTypeAnnotation(desc = "话本结算-是否同步")
    private boolean settleSync;

    public long getUserId() {
        return userId;
    }

    public void setUserId(long userId) {
        if(this.userId != userId) {
            this.userId = userId;
            setUpdateOption();
        }
    }

    public int getWeekId() {
        return weekId;
    }

    public void setWeekId(int weekId) {
        if(this.weekId != weekId) {
            this.weekId = weekId;
            setUpdateOption();
        }
    }

    public String getUnionUid() {
        return unionUid;
    }

    public void setUnionUid(String unionUid) {
        if(!Objects.equals(this.unionUid, unionUid)) {
            this.unionUid = unionUid;
            setUpdateOption();
        }
    }

    public long getServerId() {
        return serverId;
    }

    public void setServerId(long serverId) {
        if(this.serverId != serverId) {
            this.serverId = serverId;
            setUpdateOption();
        }
    }

    public int getCanSendTimes() {
        return canSendTimes;
    }

    public void setCanSendTimes(int canSendTimes) {
        if(this.canSendTimes != canSendTimes) {
            this.canSendTimes = canSendTimes;
            setUpdateOption();
        }
    }

    public int getSendTimes() {
        return sendTimes;
    }

    public void setSendTimes(int sendTimes) {
        if(this.sendTimes != sendTimes) {
            this.sendTimes = sendTimes;
            setUpdateOption();
        }
    }

    public int getResetTime() {
        return resetTime;
    }

    public void setResetTime(int resetTime) {
        if(this.resetTime != resetTime) {
            this.resetTime = resetTime;
            setUpdateOption();
        }
    }

    public int getScore() {
        return score;
    }

    public void setScore(int score) {
        if(this.score != score) {
            this.score = score;
            setUpdateOption();
        }
    }

    public int getSettleScore() {
        return settleScore;
    }

    public void setSettleScore(int settleScore) {
        if(this.settleScore != settleScore) {
            this.settleScore = settleScore;
            setUpdateOption();
        }
    }

    public UserBaseInfo getUserBaseInfo() {
        return userBaseInfo;
    }

    public void setUserBaseInfo(UserBaseInfo userBaseInfo) {
        this.userBaseInfo = userBaseInfo;
    }

    public String getUserBaseInfoJsonString(){
        if(null == userBaseInfo){
            return "{}";
        }else {
            return JSON.toJSONString(userBaseInfo);
        }
    }

    public boolean isSettleSync() {
        return settleSync;
    }

    public void setSettleSync(boolean settleSync) {
        if(this.settleSync != settleSync) {
            this.settleSync = settleSync;
            setUpdateOption();
        }
    }
}
